import { combineReducers, createStore, applyMiddleware } from 'redux';
import { combineEpics, createEpicMiddleware, Epic } from 'redux-observable';
import { ofType, StateObservable } from 'redux-observable';
import { Observable } from 'rxjs';
import { addEpics, pingEpic } from './epics';
import { addReducer } from './reducers';
export const wrapEpic = (epic: Epic<any, any>) => (
  ...args: [Observable<any>, StateObservable<any>, undefined]
) => epic(...args);
// const rootEpics = combineEpics({ addEpics: wrapEpic(addEpics), pingEpic });
const rootEpics: any = combineEpics(addEpics, pingEpic);
/* const rootEpic = (
  action$: Observable<any>,
  store$: StateObservable<any>,
  dependencies: any
) => combineEpics(addEpics))(action$, store$);
const rootReducers = combineReducers({
  root: addReducer,
});
 */
const epicMiddle = createEpicMiddleware();

const store = createStore(addReducer, applyMiddleware(epicMiddle));
epicMiddle.run(rootEpics);

export { store };
